﻿#region Using directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using webapp4U.DAL;
using System.Data;
#endregion

/// <summary>
/// Summary description for ShoppingCart
/// </summary>
/// 

namespace webapp4U.BOL
{
    public class RegisterMemberBOL
    {
        #region Member Variables
        
        private String _fullname;

        private String _nickname;

        private String _email;

        private String _password;

        private bool _gender;

        private String _birthday;

        private bool _receiveDailyMail;


        #endregion

        #region Public Properties       

        
        public String FullName
        {
            get { return _fullname; }
            set { _fullname = value; }
        }

        public String NickName
        {
            get { return _nickname; }
            set { _nickname = value; }
        }

        public String Email
        {
            get { return _email; }
            set { _email = value; }
        }

        public String Password
        {
            get { return _password; }
            set { _password = value; }
        }

        public bool Gender
        {
            get { return _gender; }
            set { _gender = value; }
        }

        public String Birthday
        {
            get { return _birthday; }
            set { _birthday = value; }
        }

        public bool ReceiveDailyMail
        {
            get { return _receiveDailyMail; }
            set { _receiveDailyMail = value; }
        }
        #endregion

        public static Double GetTotalShoppingCart(List<ShoppingCart> ShopCart)
        {
            double Total = 0;
            foreach (ShoppingCart shop in ShopCart)
            {
                Total += shop.Subtotal;
            }
            return Total;
        }

        

        // Procced Order
        public static DataTable dtListProvince(ref string error)
        {
            RegisterMemberDAL db = new RegisterMemberDAL();
            return db.dtListProvince(ref error);
        }

        public static DataTable dtListTownByProvinceCode(ref string error, string ProvinceCode)
        {
            RegisterMemberDAL db = new RegisterMemberDAL();
            return db.dtListTownByProvinceCode(ref error, ProvinceCode);
        }

       
       
        public static bool InsertMemberRegister(ref string error, string CustomerName, string NickName, string Email,
            string Password, bool Gender, string Birthday, bool ReceiveDailyEmail)
        {
            RegisterMemberDAL db = new RegisterMemberDAL();
            return db.InsertMemberRegister(ref error, CustomerName, NickName, Email, Password, Gender, Birthday, ReceiveDailyEmail);
        }



        public static bool CheckEmail(ref string error, string Email)
        {
            RegisterMemberDAL db = new RegisterMemberDAL();
            return db.CheckEmail(ref error, Email);
        }
    }
}